 <?php
 	require_once("lib/reportcreator.php");
 	require_once("dompdf/dompdf_config.inc.php");
 	
 	$pageTitle="Report";
 	
 	$reportType= $_REQUEST["type"];
 	$reportCreateor=new ReportCreator();
 	$reportVars=array();
 	$reportVars['company_name']='Company 1';
 	$reportVars['unit_name']="unit -1";
 	
 	date_default_timezone_set ("Asia/Dili");
 	$dateString =date("Y/m/d");
 	$reportVars['report_date']=$dateString;
 	
 	
 	$reportVars['report_content']="<tr><td>1</td><td>Contract Labour (R & A) Act, 1970</td><td>Registration Certificate</td><td>When Required</td><td>-</td><td></td><td>Original</td><td>Duplicate issued by Labour Deptt.</td><td>1KB</td></tr>";
 	
 	if($reportType== "html"){ //Display the HTML content
 			include ("header.php");
 			$htmlstring= $reportCreateor->createHTMLReport($reportVars);
 			echo $htmlstring;
 			include ("footer.php");
 	}elseif ($reportType== "pdf"){//Create the PDF
 		$htmlstring= $reportCreateor->createPDFReport($reportVars);
 		
 		//Create PDF;
 		$dompdf = new DOMPDF();
 		$dompdf->load_html($htmlstring);
 		$dompdf->render();
 		$dompdf->stream( $reportVars['company_name'] ."_" .$reportVars['unit_name'] ."_"  .$dateString .".pdf");
 	}
 

?>
 